<?php
/**
 * PHP By Example
 *
 * @copyright 2014 Michel Corne <mcorne@yahoo.com>
 * @license   http://www.opensource.org/licenses/gpl-3.0.html GNU GPL v3
 */
?>

<div class="top_bar">

  <a class="logo" href="<?=$this->_output->display_url();?>"><img src="<?=$this->base_url;?>/logo.gif"/> by Example</a>

  <?php if ($this->_params->search_method == 'input'):?>

    <datalist id="function_list"><option></option></datalist>

    <input <?php if ($this->_params->translation_in_action == 1001):?>class="highlight_translation_in_action"<?php endif;?>
           id="function_input"
           list="function_list"
           onkeydown="is_submit_enter_key(event) && run_searched_function('<?=$this->_output->display_url('function');?>')"
           placeholder="<?=$this->_message_translation->translate('Search a function');?>"
           type="text"
           value="<?=$this->_application->function_name;?>" />

    <input class="button search"
           onclick="run_searched_function('<?=$this->_output->display_url('function');?>')"
           type="button"
           value="↩" />

    <a class="search_method_switch" href="<?=$this->_output->display_url('function', $this->_application->function_name);?>?search_method=select"
      ><?=$this->_message_translation->translate('Display the drop-down list');?></a>

  <?php else:?>

    <span id="function_select_placeholder">
      <select id="function_select"
              onkeydown="is_submit_enter_key(event) && run_selected_function('<?=$this->_output->display_url('function');?>')">

        <option value="">-- <?=$this->_message_translation->translate('Choose a function');?> --</option>

        <?php if ($this->_application->function_name):?>
          <option selected="selected"><?=$this->_application->function_name;?></option>
        <?php endif;?>

      </select>
    </span>

    <input class="button search"
           onclick="run_selected_function('<?=$this->_output->display_url('function');?>')"
           type="button"
           value="↩" />

    <a class="search_method_switch" href="<?=$this->_output->display_url('function', $this->_application->function_name);?>?search_method=input"
      ><?=$this->_message_translation->translate('Display the text box');?></a>


  <?php endif;?>

</div>

<hr />
